#include <iostream>

//https://www.nowcoder.com/practice/dabaf13009ef4d0cbf22302fd6a530a6?tpId=225&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=https%3A%2F%2Fwww.nowcoder.com%2Fexam%2Foj

using namespace std;

bool isNarcissus(int num){
    int temp = num;
    int a = num % 10; //个位
    num /= 10;
    int b = num % 10; //十位
    num /= 10;
    int c = num % 10; //百位
    if(temp == a * a * a + b * b * b + c * c * c) //判断个位、十位、百位数各自三次方后相加是否等于该数
        return true;
    else
        return false;
}

int main() {
    for(int i = 100; i < 1000; i++){ //遍历所有的三位数
        if(isNarcissus(i)) //如果是水仙花数则输出
            cout << i << endl;
    }
    return 0;
}



